package com.study.business.article.service;

import com.study.business.article.domain.Article;
import com.study.business.article.mapper.ArticleMapper;
import com.study.business.util.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author zhang
 */
@Service
public class ArticleService {
    @Autowired
    private ArticleMapper articleMapper;

    public ResponseUtil add(Article article) {
        article.setCreateTime(new Date());
        return new ResponseUtil(200, "success", articleMapper.add(article));
    }

    public ResponseUtil findAll() {
        return new ResponseUtil(200, "success", articleMapper.findAll());
    }
}
